Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

199
Views
UnhandledPromiseRejectionWarning: ReferenceError: request is not defined || sharp

I am using sharp and would like to make a image editing discord bot. I need to use URLs for this of course so I tried that and saw a request function in the GitHub page. However, it doesn't seem to work for me. The error is in the title here is the code:


const Discord = require("discord.js")
const sharp = require("sharp")
const client = new Discord.Client()
const url = "https://934185.smushcdn.com/2425611/wp-content/uploads/2021/05/shiba-inu-2.jpeg"

async function startup() {
    request({ url, encoding: null }, function(error, response, body) {
        if (!error) {
            sharp(body).rotate().resize(300, 300).toBuffer().then(function(data) {
                console.log(data)
            })
        }
    })
}


startup()


client.on("ready", () => {
    console.log("Ready!")
})

client.login(process.env.token)
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You need to import request into your program. To install the request module, simply type this in your console:

npm i request

Then require it in your code as such:

const request = require('request');

Even better, request is deprecated so you can use something like Axios.

https://www.npmjs.com/package/axios

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!